

#include "Checker.h"
#include "Input.h"

#include <iostream>

KeyChecker::KeyChecker() {
    key = Util::SDLKey_lookup("w");
}

KeyChecker::KeyChecker(std::string s) {
    key = Util::SDLKey_lookup(s);
}

KeyChecker::~KeyChecker() {
}

bool KeyChecker::check() {
    return Input::instance().isKeyDown(key);
}

void KeyChecker::clear() {
    return Input::instance().updateKey(key, false);
}

MouseChecker::MouseChecker(std::string s) {
    button = Util::SDLButton_lookup(s);
//    std::cerr << "new MouseChecker " << s << " button " << button << std::endl;
}

void MouseChecker::clear() {
    return Input::instance().updateMouseButton(button, false);
}

bool MouseChecker::check(){
    bool ret = Input::instance().isButtonDown(button);
//    if (ret)
//        std::cerr << "MouseChecker check button " << button << std::endl;
    return ret;
}

MouseChecker::~MouseChecker() {
}
